\section{foe\+\_\+request.\+c File Reference}
\label{foe__request_8c}\index{foe\+\_\+request.\+c@{foe\+\_\+request.\+c}}


File-\/over-\/\+Ether\+C\+AT request functions.  


\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{foe__request_8c_abb224b1d4a9cdbad17f5e3403e962784}} 
\#define \textbf{ E\+C\+\_\+\+F\+O\+E\+\_\+\+R\+E\+Q\+U\+E\+S\+T\+\_\+\+R\+E\+S\+P\+O\+N\+S\+E\+\_\+\+T\+I\+M\+E\+O\+UT}~3000
\begin{DoxyCompactList}\small\item\em Default timeout in ms to wait for FoE transfer responses. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \textbf{ ec\+\_\+foe\+\_\+request\+\_\+clear\+\_\+data} (\textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$req)
\begin{DoxyCompactList}\small\item\em FoE request destructor. \end{DoxyCompactList}\item 
void \textbf{ ec\+\_\+foe\+\_\+request\+\_\+init} (\textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$req, uint8\+\_\+t $\ast$file\+\_\+name)
\begin{DoxyCompactList}\small\item\em FoE request constructor. \end{DoxyCompactList}\item 
void \textbf{ ec\+\_\+foe\+\_\+request\+\_\+clear} (\textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$req)
\begin{DoxyCompactList}\small\item\em FoE request destructor. \end{DoxyCompactList}\item 
int \textbf{ ec\+\_\+foe\+\_\+request\+\_\+alloc} (\textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$req, size\+\_\+t size)
\begin{DoxyCompactList}\small\item\em Pre-\/allocates the data memory. \end{DoxyCompactList}\item 
int \textbf{ ec\+\_\+foe\+\_\+request\+\_\+copy\+\_\+data} (\textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$req, const uint8\+\_\+t $\ast$source, size\+\_\+t size)
\begin{DoxyCompactList}\small\item\em Copies FoE data from an external source. \end{DoxyCompactList}\item 
int \textbf{ ec\+\_\+foe\+\_\+request\+\_\+timed\+\_\+out} (const \textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$req)
\begin{DoxyCompactList}\small\item\em Checks, if the timeout was exceeded. \end{DoxyCompactList}\item 
void \textbf{ ec\+\_\+foe\+\_\+request\+\_\+timeout} (\textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$req, uint32\+\_\+t timeout)
\begin{DoxyCompactList}\small\item\em Set the request timeout. \end{DoxyCompactList}\item 
uint8\+\_\+t $\ast$ \textbf{ ec\+\_\+foe\+\_\+request\+\_\+data} (\textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$req)
\begin{DoxyCompactList}\small\item\em Returns a pointer to the request\textquotesingle{}s data. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ ec\+\_\+foe\+\_\+request\+\_\+data\+\_\+size} (const \textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$req)
\begin{DoxyCompactList}\small\item\em Returns the data size. \end{DoxyCompactList}\item 
void \textbf{ ec\+\_\+foe\+\_\+request\+\_\+read} (\textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$req)
\begin{DoxyCompactList}\small\item\em Prepares a read request (slave to master). \end{DoxyCompactList}\item 
void \textbf{ ec\+\_\+foe\+\_\+request\+\_\+write} (\textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$req)
\begin{DoxyCompactList}\small\item\em Prepares a write request (master to slave). \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
File-\/over-\/\+Ether\+C\+AT request functions. 



\subsection{Function Documentation}
\mbox{\label{foe__request_8c_ad58b94538d29363f9132f222ef574a74}} 
\index{foe\+\_\+request.\+c@{foe\+\_\+request.\+c}!ec\+\_\+foe\+\_\+request\+\_\+clear\+\_\+data@{ec\+\_\+foe\+\_\+request\+\_\+clear\+\_\+data}}
\index{ec\+\_\+foe\+\_\+request\+\_\+clear\+\_\+data@{ec\+\_\+foe\+\_\+request\+\_\+clear\+\_\+data}!foe\+\_\+request.\+c@{foe\+\_\+request.\+c}}
\subsubsection{ec\+\_\+foe\+\_\+request\+\_\+clear\+\_\+data()}
{\footnotesize\ttfamily void ec\+\_\+foe\+\_\+request\+\_\+clear\+\_\+data (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$}]{req }\end{DoxyParamCaption})}



FoE request destructor. 


\begin{DoxyParams}{Parameters}
{\em req} & FoE request. \\
\hline
\end{DoxyParams}


Definition at line 89 of file foe\+\_\+request.\+c.

\mbox{\label{foe__request_8c_a3bf07dbd22177d67d2378d6d4849f82d}} 
\index{foe\+\_\+request.\+c@{foe\+\_\+request.\+c}!ec\+\_\+foe\+\_\+request\+\_\+init@{ec\+\_\+foe\+\_\+request\+\_\+init}}
\index{ec\+\_\+foe\+\_\+request\+\_\+init@{ec\+\_\+foe\+\_\+request\+\_\+init}!foe\+\_\+request.\+c@{foe\+\_\+request.\+c}}
\subsubsection{ec\+\_\+foe\+\_\+request\+\_\+init()}
{\footnotesize\ttfamily void ec\+\_\+foe\+\_\+request\+\_\+init (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$}]{req,  }\item[{uint8\+\_\+t $\ast$}]{file\+\_\+name }\end{DoxyParamCaption})}



FoE request constructor. 


\begin{DoxyParams}{Parameters}
{\em req} & FoE request. \\
\hline
{\em file\+\_\+name} & filename \\
\hline
\end{DoxyParams}


Definition at line 57 of file foe\+\_\+request.\+c.

\mbox{\label{foe__request_8c_ac9c5c98c785cf2395cdf437fefedcdaf}} 
\index{foe\+\_\+request.\+c@{foe\+\_\+request.\+c}!ec\+\_\+foe\+\_\+request\+\_\+clear@{ec\+\_\+foe\+\_\+request\+\_\+clear}}
\index{ec\+\_\+foe\+\_\+request\+\_\+clear@{ec\+\_\+foe\+\_\+request\+\_\+clear}!foe\+\_\+request.\+c@{foe\+\_\+request.\+c}}
\subsubsection{ec\+\_\+foe\+\_\+request\+\_\+clear()}
{\footnotesize\ttfamily void ec\+\_\+foe\+\_\+request\+\_\+clear (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$}]{req }\end{DoxyParamCaption})}



FoE request destructor. 


\begin{DoxyParams}{Parameters}
{\em req} & FoE request. \\
\hline
\end{DoxyParams}


Definition at line 78 of file foe\+\_\+request.\+c.

\mbox{\label{foe__request_8c_a21195eb686c217bbf70ba0cde620db52}} 
\index{foe\+\_\+request.\+c@{foe\+\_\+request.\+c}!ec\+\_\+foe\+\_\+request\+\_\+alloc@{ec\+\_\+foe\+\_\+request\+\_\+alloc}}
\index{ec\+\_\+foe\+\_\+request\+\_\+alloc@{ec\+\_\+foe\+\_\+request\+\_\+alloc}!foe\+\_\+request.\+c@{foe\+\_\+request.\+c}}
\subsubsection{ec\+\_\+foe\+\_\+request\+\_\+alloc()}
{\footnotesize\ttfamily int ec\+\_\+foe\+\_\+request\+\_\+alloc (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$}]{req,  }\item[{size\+\_\+t}]{size }\end{DoxyParamCaption})}



Pre-\/allocates the data memory. 

If the internal {\itshape buffer\+\_\+size} is already bigger than {\itshape size}, nothing is done.

\begin{DoxyReturn}{Returns}
Zero on success, otherwise a negative error code. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em req} & FoE request. \\
\hline
{\em size} & Data size to allocate. \\
\hline
\end{DoxyParams}


Definition at line 111 of file foe\+\_\+request.\+c.

\mbox{\label{foe__request_8c_a0da867374db00df58d806644209cf1cb}} 
\index{foe\+\_\+request.\+c@{foe\+\_\+request.\+c}!ec\+\_\+foe\+\_\+request\+\_\+copy\+\_\+data@{ec\+\_\+foe\+\_\+request\+\_\+copy\+\_\+data}}
\index{ec\+\_\+foe\+\_\+request\+\_\+copy\+\_\+data@{ec\+\_\+foe\+\_\+request\+\_\+copy\+\_\+data}!foe\+\_\+request.\+c@{foe\+\_\+request.\+c}}
\subsubsection{ec\+\_\+foe\+\_\+request\+\_\+copy\+\_\+data()}
{\footnotesize\ttfamily int ec\+\_\+foe\+\_\+request\+\_\+copy\+\_\+data (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$}]{req,  }\item[{const uint8\+\_\+t $\ast$}]{source,  }\item[{size\+\_\+t}]{size }\end{DoxyParamCaption})}



Copies FoE data from an external source. 

If the {\itshape buffer\+\_\+size} is to small, new memory is allocated.

\begin{DoxyReturn}{Returns}
Zero on success, otherwise a negative error code. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em req} & FoE request. \\
\hline
{\em source} & Source data. \\
\hline
{\em size} & Number of bytes in {\itshape source}. \\
\hline
\end{DoxyParams}


Definition at line 140 of file foe\+\_\+request.\+c.

\mbox{\label{foe__request_8c_a1951f5cf5abf840d0a8458b11c7ce060}} 
\index{foe\+\_\+request.\+c@{foe\+\_\+request.\+c}!ec\+\_\+foe\+\_\+request\+\_\+timed\+\_\+out@{ec\+\_\+foe\+\_\+request\+\_\+timed\+\_\+out}}
\index{ec\+\_\+foe\+\_\+request\+\_\+timed\+\_\+out@{ec\+\_\+foe\+\_\+request\+\_\+timed\+\_\+out}!foe\+\_\+request.\+c@{foe\+\_\+request.\+c}}
\subsubsection{ec\+\_\+foe\+\_\+request\+\_\+timed\+\_\+out()}
{\footnotesize\ttfamily int ec\+\_\+foe\+\_\+request\+\_\+timed\+\_\+out (\begin{DoxyParamCaption}\item[{const \textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$}]{req }\end{DoxyParamCaption})}



Checks, if the timeout was exceeded. 

\begin{DoxyReturn}{Returns}
non-\/zero if the timeout was exceeded, else zero. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em req} & FoE request. \\
\hline
\end{DoxyParams}


Definition at line 164 of file foe\+\_\+request.\+c.

\mbox{\label{foe__request_8c_a9690708688a0d25c257deaf386fbc7b6}} 
\index{foe\+\_\+request.\+c@{foe\+\_\+request.\+c}!ec\+\_\+foe\+\_\+request\+\_\+timeout@{ec\+\_\+foe\+\_\+request\+\_\+timeout}}
\index{ec\+\_\+foe\+\_\+request\+\_\+timeout@{ec\+\_\+foe\+\_\+request\+\_\+timeout}!foe\+\_\+request.\+c@{foe\+\_\+request.\+c}}
\subsubsection{ec\+\_\+foe\+\_\+request\+\_\+timeout()}
{\footnotesize\ttfamily void ec\+\_\+foe\+\_\+request\+\_\+timeout (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$}]{req,  }\item[{uint32\+\_\+t}]{timeout }\end{DoxyParamCaption})}



Set the request timeout. 


\begin{DoxyParams}{Parameters}
{\em req} & FoE request. \\
\hline
{\em timeout} & Timeout in ms. \\
\hline
\end{DoxyParams}


Definition at line 176 of file foe\+\_\+request.\+c.

\mbox{\label{foe__request_8c_a476b47a2c569870be295e5bb70cf68df}} 
\index{foe\+\_\+request.\+c@{foe\+\_\+request.\+c}!ec\+\_\+foe\+\_\+request\+\_\+data@{ec\+\_\+foe\+\_\+request\+\_\+data}}
\index{ec\+\_\+foe\+\_\+request\+\_\+data@{ec\+\_\+foe\+\_\+request\+\_\+data}!foe\+\_\+request.\+c@{foe\+\_\+request.\+c}}
\subsubsection{ec\+\_\+foe\+\_\+request\+\_\+data()}
{\footnotesize\ttfamily uint8\+\_\+t$\ast$ ec\+\_\+foe\+\_\+request\+\_\+data (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$}]{req }\end{DoxyParamCaption})}



Returns a pointer to the request\textquotesingle{}s data. 

\begin{DoxyReturn}{Returns}
Data pointer. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em req} & FoE request. \\
\hline
\end{DoxyParams}


Definition at line 190 of file foe\+\_\+request.\+c.

\mbox{\label{foe__request_8c_a1d657fe94180c35e0651134f3dda6876}} 
\index{foe\+\_\+request.\+c@{foe\+\_\+request.\+c}!ec\+\_\+foe\+\_\+request\+\_\+data\+\_\+size@{ec\+\_\+foe\+\_\+request\+\_\+data\+\_\+size}}
\index{ec\+\_\+foe\+\_\+request\+\_\+data\+\_\+size@{ec\+\_\+foe\+\_\+request\+\_\+data\+\_\+size}!foe\+\_\+request.\+c@{foe\+\_\+request.\+c}}
\subsubsection{ec\+\_\+foe\+\_\+request\+\_\+data\+\_\+size()}
{\footnotesize\ttfamily size\+\_\+t ec\+\_\+foe\+\_\+request\+\_\+data\+\_\+size (\begin{DoxyParamCaption}\item[{const \textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$}]{req }\end{DoxyParamCaption})}



Returns the data size. 

\begin{DoxyReturn}{Returns}
Data size. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em req} & FoE request. \\
\hline
\end{DoxyParams}


Definition at line 203 of file foe\+\_\+request.\+c.

\mbox{\label{foe__request_8c_a1abc468b6ec2292415b084f15beeb3d4}} 
\index{foe\+\_\+request.\+c@{foe\+\_\+request.\+c}!ec\+\_\+foe\+\_\+request\+\_\+read@{ec\+\_\+foe\+\_\+request\+\_\+read}}
\index{ec\+\_\+foe\+\_\+request\+\_\+read@{ec\+\_\+foe\+\_\+request\+\_\+read}!foe\+\_\+request.\+c@{foe\+\_\+request.\+c}}
\subsubsection{ec\+\_\+foe\+\_\+request\+\_\+read()}
{\footnotesize\ttfamily void ec\+\_\+foe\+\_\+request\+\_\+read (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$}]{req }\end{DoxyParamCaption})}



Prepares a read request (slave to master). 


\begin{DoxyParams}{Parameters}
{\em req} & FoE request. \\
\hline
\end{DoxyParams}


Definition at line 214 of file foe\+\_\+request.\+c.

\mbox{\label{foe__request_8c_a097a26d460304eb8b84a9a9d21345048}} 
\index{foe\+\_\+request.\+c@{foe\+\_\+request.\+c}!ec\+\_\+foe\+\_\+request\+\_\+write@{ec\+\_\+foe\+\_\+request\+\_\+write}}
\index{ec\+\_\+foe\+\_\+request\+\_\+write@{ec\+\_\+foe\+\_\+request\+\_\+write}!foe\+\_\+request.\+c@{foe\+\_\+request.\+c}}
\subsubsection{ec\+\_\+foe\+\_\+request\+\_\+write()}
{\footnotesize\ttfamily void ec\+\_\+foe\+\_\+request\+\_\+write (\begin{DoxyParamCaption}\item[{\textbf{ ec\+\_\+foe\+\_\+request\+\_\+t} $\ast$}]{req }\end{DoxyParamCaption})}



Prepares a write request (master to slave). 


\begin{DoxyParams}{Parameters}
{\em req} & FoE request. \\
\hline
\end{DoxyParams}


Definition at line 228 of file foe\+\_\+request.\+c.

